<%--  This file is part of LitSearch.

    LitSearch is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    LitSearch is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with LitSearch; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA --%>

<%@ page import=" java.util.regex.*" %>
<%@ page import=" java.lang.*" %>
<%@ page import=" java.lang.String" %>
<%@ page import=" java.util.*" %>

<jsp:useBean scope="session" id="languageObj" class="de.fhbrs.litsearch.LanguageBean"  />
<jsp:useBean scope="session" id="userObj" class="de.fhbrs.litsearch.UserBean" />
<jsp:useBean scope="session" id="mySearch" class="de.fhbrs.litsearch.SearchBean" />



<%
mySearch.setLanguage(languageObj);
mySearch.setUserObject(userObj);
String searchMessage="";	
boolean error=false;

 mySearch.emptyWallet(request.getParameter("clear"));



if(request.getParameter("startwert")!=null){
	mySearch.setStartwert(request.getParameter("startwert"));
}

if(request.getParameter("toggle")!=null){
	mySearch.toggleWallet(Integer.parseInt(request.getParameter("toggle")));

}

if(request.getParameter("orderBy")!=null)
	try{
		mySearch.setOrderBy(request.getParameter("orderBy"));
	}catch(Exception e){
	
}

if(request.getParameter("orderDirection")!=null)
	try{
		mySearch.setOrderDirection(request.getParameter("orderDirection"));
	}catch(Exception e){
	
}


	mySearch.setView("wallet");
try{
	mySearch.getWalletMedia();
	}catch(Exception e){
	searchMessage=e.getMessage();
	error=true;
	}


%>

<script type="text/javascript">
<!--
 document.searchForm.searchString.focus();
 document.searchForm.searchString.select();
//-->
</script>
<b><%=languageObj.getTextFor("wallet.walletText")%><%= mySearch.walletSize() %> <%=languageObj.getTextFor("wallet.items")%></b>
<div style="width:100%">&nbsp;</div>
<div style="width:100%"><a href="index.jsp?content=wallet&amp;clear=yes"><%=languageObj.getTextFor("wallet.clearWallet")%></a></div>

<%
if(mySearch.getAnzWalletResults()>0 && !error){
%>

<table width="100%" border="0" cellpadding="10" style=" border: 1px groove black; ">
	<tr >
		<th>No.</th>
		<th></th>
		<th><a href="index.jsp?content=wallet&amp;startwert=<%=mySearch.getStartwert()%>&amp;searchString=<%=mySearch.getSearchWord()%>&amp;orderBy=litart&amp;orderDirection=<%=mySearch.getOppositeOrderDirection()%>"><%= mySearch.getOrderDirectionIcon("litart") %> <%=languageObj.getTextFor("search.Type")%></a></th>
		<th><a href="index.jsp?content=wallet&amp;startwert=<%=mySearch.getStartwert()%>&amp;searchString=<%=mySearch.getSearchWord()%>&amp;orderBy=author&amp;orderDirection=<%=mySearch.getOppositeOrderDirection()%>"><%= mySearch.getOrderDirectionIcon("author") %> <%=languageObj.getTextFor("search.Author")%></a></th>
		<th><a href="index.jsp?content=wallet&amp;startwert=<%=mySearch.getStartwert()%>&amp;searchString=<%=mySearch.getSearchWord()%>&amp;orderBy=title1&amp;orderDirection=<%=mySearch.getOppositeOrderDirection()%>"><%= mySearch.getOrderDirectionIcon("title1") %> <%=languageObj.getTextFor("search.Title")%></a></th>
		<th style="width:50px;"><a href="index.jsp?content=wallet&amp;startwert=<%=mySearch.getStartwert()%>&amp;searchString=<%=mySearch.getSearchWord()%>&amp;orderBy=year&amp;orderDirection=<%=mySearch.getOppositeOrderDirection()%>"><%= mySearch.getOrderDirectionIcon("year") %> <%=languageObj.getTextFor("search.Year")%></a></th>
	</tr>

<%= mySearch.getWalletResults() %>
</table>
<%}%>




<div id="export"><div class="right"><a href="export.jsp?do=bibtex&amp;what=wallet">BibTex-Export</a> | <a href="export.jsp?do=csv&amp;what=wallet">CSV-Export</a> | <a href="export.jsp?do=print&amp;what=wallet" target="_new"><%= languageObj.getTextFor("search.PrintView") %></a></div></div>
<div style="width:100%">&nbsp;</div>


<%

//out.print(mySearch.getSqlSearch());

%>